
export const blobDownload = function(data, fileName) {
  if (window.navigator.msSaveBlob) {
    try {
      const blobObject = new Blob([data])
      window.navigator.msSaveBlob(blobObject, fileName)
    } catch (e) {
      console.log(e)
    }
  } else {
    //  其他浏览器
    const url = window.URL.createObjectURL(new Blob([data]))
    const link = document.createElement('a')
    link.href = url
    link.setAttribute('download', fileName)
    document.body.appendChild(link)
    link.click()
    document.body.removeChild(link) // 下载完成移除元素
    window.URL.revokeObjectURL(url) // 释放掉blob对象
  }
}
